package com.hgd.igreencar.biz.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hgd.igreencar.biz.ICarPersonBiz;
import com.hgd.igreencar.dao.CarPersonMapper;
import com.hgd.igreencar.entity.CarPerson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CarPersonBizImpl implements ICarPersonBiz {
    @Autowired
    private CarPersonMapper carPersonMapper;

//  默认显示所有的车主信息
    @Override
    public PageInfo<CarPerson> queryAllData(int currentPage, int pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        PageInfo pageInfo = new PageInfo(carPersonMapper.queryAllData(currentPage,pageSize));
        return pageInfo;
    }

    @Override
    public PageInfo<CarPerson> queryAllOverData(int currentPage, int pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        PageInfo pageInfo = new PageInfo(carPersonMapper.queryAllOverData(currentPage,pageSize));
        return pageInfo;
    }

//  按需显示
    @Override
    public PageInfo<CarPerson> queryData(String areaName, String brandName, int currentPage, int pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        PageInfo pageInfo = new PageInfo(carPersonMapper.queryData(areaName, brandName, currentPage, pageSize));
        return pageInfo;
    }

    @Override
    public PageInfo<CarPerson> queryByOver(String areaName, String brandName, int currentPage, int pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        PageInfo pageInfo = new PageInfo(carPersonMapper.queryByOver(areaName, brandName, currentPage, pageSize));
        return pageInfo;
    }
}
